package com.gitee.dictionary.properties;

import com.gitee.dictionary.base.BaseDictionaryEnum;
import com.gitee.dictionary.enums.DuplicatedBehaviour;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author <a href="mailto:lin-mt@outlook.com">lin-mt</a>
 */
@ConfigurationProperties(prefix = ConfigProperties.MYBATIS_DICTIONARY_ENUM_PREFIX)
public class ConfigProperties {
    
    public static final String MYBATIS_DICTIONARY_ENUM_PREFIX = "dictionary-enum.jpa";
    
    /**
     * 扫描所有数据字典枚举所在的包
     */
    private String enumPackages;
    
    /**
     * 系统基础类
     */
    private Class<? extends BaseDictionaryEnum> baseEnumClass;
    
    /**
     * 默认超过100个枚举则全部缓存下来，小于等于 0 则全部缓存
     */
    private int cacheSize = 100;
    
    /**
     * 出现重复code时的告知方式
     */
    private DuplicatedBehaviour duplicated = DuplicatedBehaviour.EXCEPTION;
    
    /**
     * 是否开启Code层级校验
     */
    private Boolean enableCodeCheck = Boolean.TRUE;
    
    /**
     * code一层的长度
     */
    private int oneLevelLength = 2;
    
    /**
     * code最大的层数
     */
    private int maxLevelCount = 3;
    
    public String getEnumPackages() {
        return this.enumPackages;
    }
    
    public void setEnumPackages(String enumPackages) {
        this.enumPackages = enumPackages;
    }
    
    public Class<? extends BaseDictionaryEnum> getBaseEnumClass() {
        return this.baseEnumClass;
    }
    
    public void setBaseEnumClass(Class<? extends BaseDictionaryEnum> baseEnumClass) {
        this.baseEnumClass = baseEnumClass;
    }
    
    public int getCacheSize() {
        return this.cacheSize;
    }
    
    public void setCacheSize(int cacheSize) {
        this.cacheSize = cacheSize;
    }
    
    public DuplicatedBehaviour getDuplicated() {
        return this.duplicated;
    }
    
    public void setDuplicated(DuplicatedBehaviour duplicated) {
        this.duplicated = duplicated;
    }
    
    public Boolean getEnableCodeCheck() {
        return this.enableCodeCheck;
    }
    
    public void setEnableCodeCheck(Boolean enableCodeCheck) {
        this.enableCodeCheck = enableCodeCheck;
    }
    
    public int getOneLevelLength() {
        return this.oneLevelLength;
    }
    
    public void setOneLevelLength(int oneLevelLength) {
        this.oneLevelLength = oneLevelLength;
    }
    
    public int getMaxLevelCount() {
        return this.maxLevelCount;
    }
    
    public void setMaxLevelCount(int maxLevelCount) {
        this.maxLevelCount = maxLevelCount;
    }
}
